﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CatAndMouse
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        Cat cat = new Cat("Tom");
        Mouse mouse1 = new Mouse("mouse1");
        Mouse mouse2 = new Mouse("mouse2");

        private void button1_Click(object sender, EventArgs e)
        {
            cat.Shout();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            cat.CatShout += new Cat.CatShoutEventHandler(mouse1.Run);
            cat.CatShout += new Cat.CatShoutEventHandler(mouse2.Run);
            //指向到某个对象的某个方法 那个方法能访问特定对象的数据
        }
    }
}
